package com.ruoyi.web.runner;

import com.ruoyi.ex.service.IExQuestionBankService;
import com.ruoyi.ex.service.IExQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.concurrent.Executors;

/**
 * @author zzxjs
 * 题库启动类
 */
@Component
public class ExRunner implements CommandLineRunner {

    @Autowired private IExQuestionService service;


    @Override
    public void run(String... args) throws Exception {
        //项目启动时将数据加载缓存
        Executors.newSingleThreadExecutor().execute(()->{
            service.cacheQuestions();
        });
    }


}
